package com.jf.cloud.api.product.feign;

import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.order.vo.ShopCartVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "jfcloud-product",contextId = "giveaway")
public interface GiveawayFeignClient {

    /**
     * 补充赠品信息
     * @param shopCart
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/product/buildGiveaway")
    ServerResponseEntity<ShopCartVO> buildGiveaway(@RequestBody ShopCartVO shopCart);

    /**
     * 主商品下架时失效赠品活动
     * @param spuId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/giveaway/changeGiveawayStatus")
    ServerResponseEntity<Void> changeGiveawayStatus(@RequestParam("spuId") Long spuId);

    /**
     * 赠送商品上下架时删除购物车缓存
     * @param spuId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/giveaway/changeGiveawaySpuStatus")
    ServerResponseEntity<Void> changeGiveawaySpuStatus(@RequestParam("spuId") Long spuId);

}
